package com.book.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;

import java.util.Date;

/**
 * @Author: 125715
 * @Package: com.book.config
 * @Date: 2025/4/2 17:44
 * @Description: 自动填充配置
 */
public class MyMetaObjectHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        this.strictInsertFill(metaObject, "createTime", Date.class, new Date());
    }
    @Override
    public void updateFill(MetaObject metaObject){
            this.setFieldValByName("updateTime", new Date(), metaObject);
        }
}